﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Web.Security;
using SIMCObjetoNegocio;

public partial class Account_Login : System.Web.UI.Page
{
    protected void LoginUser_LoggedIn(object sender, EventArgs e)
    {
        
            SimcMembershipProvider provider = (SimcMembershipProvider)Membership.Provider;

            Session["Usuario"] = provider.Usuario;


            if (((MembershipUsuario)Session["Usuario"]) != null)
            {
                Session["Variable"] = new SessionVariable();

                if (provider.Usuario.TipoUsuario == TipoUsuario.Interno && provider.Usuario.rol == null)
                {
                    Response.Redirect("SeleccionDeRol.aspx");
                }
                else
                {
                    Response.Redirect("~/Principal.aspx");
                }
            }
        
        
    }
    protected void LoginUser_LoginError(object sender, EventArgs e)
    {
        try
        {
            LoginUser.FailureText = "El usuario y/o contraseña son inválidos";
        }
        catch (Exception ex)
        {
            LoginUser.FailureText = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
